//
//  AutoLayoutFrame.m
//  QRMaster
//
//  Created by myApple on 16/4/12.
//  Copyright © 2016年 myApple. All rights reserved.
//

#import "AutoLayoutFrame.h"

//static const float iphone4x = 0.853;
//static const float iphone5x = 0.853;
//static const float iphone6px = 1.104;
static const float iphone4y = 0.720;
static const float iphone5y = 0.852;
static const float iphone6py = 1.103;

@implementation AutoLayoutFrame

+(CGRect)autoRect:(CGRect)frame
{
    CGRect autoSizeRect;
    float screenHeight = [UIScreen mainScreen].bounds.size.height;
    if (screenHeight == 480) {
        autoSizeRect = CGRectMake(frame.origin.x, frame.origin.y , frame.size.width, frame.size.height * iphone4y);
    }
    else if (screenHeight == 568)
    {
        autoSizeRect = CGRectMake(frame.origin.x, frame.origin.y , frame.size.width, frame.size.height * iphone5y);
    }
    else if (screenHeight == 736)
    {
        autoSizeRect = CGRectMake(frame.origin.x, frame.origin.y , frame.size.width, frame.size.height * iphone6py);
    }
    else
    {
        autoSizeRect = frame;
    }
    return autoSizeRect;
}

+(CGFloat)autoSizeY:(CGFloat)y
{
    CGFloat height;
    float screenHeight = [UIScreen mainScreen].bounds.size.height;
    if (screenHeight == 480) {
        height = y * iphone4y;
    }
    else if (screenHeight == 568)
    {
        height = y * iphone5y;
    }
    else if (screenHeight == 736)
    {
        height = y * iphone6py;
    }
    else
    {
        height = y;
    }
    return height;
}

@end
